package com.isoft.jms.both;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import com.isoft.jms.JmsConfig;
/**
 * 同时接收两种模式的消息
 * @Author yigeyanse@hotmail.com
 * @Date 2017年9月6日 上午9:12:25
 */
@Component
public class BothConsumer {

	@JmsListener(destination = JmsConfig.TOPIC, containerFactory = "jmsListenerContainerTopic")
	public void onTopicMessage(String msg) {
		System.out.println("接收到topic消息：" + msg);
	}

	@JmsListener(destination = JmsConfig.QUEUE, containerFactory = "jmsListenerContainerQueue")
	public void onQueueMessage(String msg) {
		System.out.println("接收到queue消息：" + msg);
	}
}
